CMOS.TXT Purpose ******* 1. Naive users sometimes meddle with CMOS settings. We need a fast way to put the scores of subtle CMOS configuration settings back the way they were. 2. Power surges can corrupt CMOS. We need a way for a naive user to quickly restore all the CMOS settings. 3. If the battery fails, the contents will be lost. We need a way to restore a known working CMOS configuration. Syntax ****** There are three utilities in the CMOS suite: CMOSSAVE.COM A:Myfile.Sav IF ERRORLEVEL 1 GO TO Trouble - saves a copy of CMOS in a file on hard disk or floppy. CMOSREST.COM A:MyFile.Sav IF ERRORLEVEL 1 GO TO Trouble - restores CMOS from a file on hard disk or floppy. CMOSCHK.COM A:MyFile.Sav IF ERRORLEVEL 1 GO TO FixIt - checks that CMOS has not been meddled with since the last CMOSSAVE. Compares CMOS with a file on hard disk or floppy. Hints on Use ************ Do a CMOSSAVE both to hard disk and to floppy. The hard disk copy can be used for quick restores built into your AUTOEXEC.BAT file. CMOSCHK.COM C:\MyCMOS.Sav IF ERRORLEVEL 1 CMOSREST.COM C:\MyCMOS.Sav Sometimes CMOS will be so badly damaged the hard disk parameters will be corrupt and your hard disk will stop working. In that case you will have to revert to using the floppy copy. Wheneever you change your CMOS setting deliberately, you need to redo the CMOSSAV.COM. However USE A NEW FILENAME, so that you can easily revert to the old version if your new settings do not pan out. How it works ************ CMOSSAVE.COM simply copies the 128 byte contents of the CMOS bytes to a file. CMOSREST.COM copies them back. CMOSCHK compares them with the file contents. If they are not equal it sets ERRORLEVEL 1. CMOSREST does not touch bytes 0 to 0Fh and 32h because these are volatile -- they contain the date and time. Similarly CMOSCHK, does not panic if any of these volatile bytes differ. Hovever, CMOSSAVE saves all 128 bytes, so that you can browse the generated file with a hex editor to learn more about how CMOS works. Because CMOSSave also saves the extended CMOS bytes, CMOSRest will restore the esoteric options like shadow RAM, wait states, processor clock speed, HMA enable etc. These is no need to calculate checksums, since the checksum is saved and restored just like any other CMOS byte. I have included a file called CHKMOS.BAT which can be inserted in your AUTOEXEC.BAT which uses all three utilities. How CMOS is used **************** CMOS is battery backed RAM that stores configuration information when the power is off. It is on my top ten worst ideas list of all time. The problem is, CMOS is far too easily corrupted, by programs, power or meddling. offset purpose 00 seconds time of day 01 secords alarm 02 minutes time of day 03 minutes alarm 04 hours time of day 05 hours alarm 06 day of week 07 alarm day of month 08 month of year 09 year 1980=0 0A status register A 0B status register B alarm 0C status register C flags 0D status register D battery 0E diagnostics status 0F shutdown status !10* diskette type !11* reserved !12* hard disk type !13* reserved !14* LSB equipment word !15* LSB base RAM in K !16* MSB base RAM in K !17* LSB expansion RAM in K !18* MSB expansion RAM in K !19* fixed disk type C: extension !1A* fixed disk type D: extension !1B*.2D reserved !2E* MSB checksum !2F* LSB checksum !30 LSB extended RAM in K above 1 MB !31 MSB extended RAM in K above 1 MB 32 BCD Century !33 128K info status byte !34..3F reserved !40..79 reserved for use by chipset maker ! = must be restored * = checksummed Author ****** CMOSSAVE, CMOSREST and CMOSCHK are copyrighted but may be freely used for any purpose except military. MASM source is available. Please report bugs and problems to: Roedy Green Canadian Mind Products #168 - 1020 Mainland Street Vancouver BC Canada V6B 2T4 (604) 684-6529 Electronic mail users can contact me on: BIX id ROEDY ENVOY id ROEDY Zoomit id GREEN ROEDY Harvey Fishman wrote a pair of programs similar to CMOSSAVE and CMOSREST, but to the best of my knowledge, never released them.